
function SuperType(name) {
  this.name = name;
  this.colors = ['red', 'blue', 'green'];
}

SuperType.prototype.sayName = function() {
  console.log(this.name);
}

function SubType(name, age) {
  // this指向实例对象
  SuperType.call(this, name);
  this.age = age;
}
// 与组合继承的差别
SubType.prototype = Object.create(SuperType.prototype);
SubType.prototype.constructor = SubType;

SubType.prototype.sayAge = function() {
  console.log(this.age);
}

let instance = new SubType('wzy', 29);
console.log(instance);
console.log(SubType.prototype);
console.log(instance.__proto__);